package com.jerry.mingxing.ui.categroy;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;


import java.util.List;

/**
 * Created by Administrator on 2016/8/30.
 */
public class CategroyAdapter extends FragmentPagerAdapter{
    private List<Fragment> totallist;

    private String[] titleList;

    public CategroyAdapter(FragmentManager fm, List<Fragment> totallist,String[]  titleList) {
        super(fm);
        this.totallist = totallist;

        this.titleList=titleList;
    }

    @Override
    public Fragment getItem(int position) {
        return totallist.get(position);
    }

    @Override
    public int getCount() {
        return totallist.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titleList[position%titleList.length];
    }


    public void reloadData(List list) {
        totallist=list;
        notifyDataSetChanged();
    }
}
